#define _CRT_SECURE_NO_WARNINGS	

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
typedef struct ListNode ListNode;
struct ListNode* middleNode(struct ListNode* head)
{
    ListNode* slow, * fast;
    slow = fast = head;
    while ((fast != NULL) && (fast->next != NULL))
    {
        fast = (fast->next)->next;
        slow = slow->next;
    }
    return slow;
}